﻿' LibWowHeroes
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Library General Public License (LGPL) Version 2.1.

Imports roncliProductions.LibWowHeroes
Imports System

Public Module modMain

    Public Sub Main()

        ' First, get the zone
        Dim strZone As String = ""

        Console.WriteLine("LibWowHeroes Demo")
        Console.WriteLine()
        Console.WriteLine("Select a zone to use.")
        Console.WriteLine("1 - US and Oceanic")
        Console.WriteLine("2 - European")
        Console.Write(">")
        Dim strResponse As String = Console.ReadLine()
        If String.IsNullOrEmpty(strResponse) Then Exit Sub
        Dim intResponse As Integer
        If Integer.TryParse(strResponse, intResponse) Then
            Select Case intResponse
                Case 1
                    strZone = "us"
                Case 2
                    strZone = "eu"
                Case Else
                    Exit Sub
            End Select
        End If

        ' Next, get the realm
        Dim strRealm As String
        Console.WriteLine()
        Console.WriteLine("Next, enter the realm to use.")
        Console.Write(">")
        strResponse = Console.ReadLine()
        If String.IsNullOrEmpty(strResponse) Then Exit Sub
        strRealm = strResponse

        ' Finally, get the guild name
        Dim strGuild As String
        Console.WriteLine()
        Console.WriteLine("Next, enter the guild name.")
        Console.Write(">")
        strResponse = Console.ReadLine()
        If String.IsNullOrEmpty(strResponse) Then Exit Sub
        strGuild = strResponse

        ' Now process the data and return the results
        Console.Clear()
        Dim xgGuild As New XmlGuild(strZone, strRealm, strGuild)

        Console.WriteLine("WoW Heroes character list for {0}-{1}-{2}", strZone, strRealm, strGuild)
        Console.WriteLine()
        For Each cCharacter As XmlGuild.Character In xgGuild.Characters
            Console.WriteLine("{0} - {1} {2} {3} {4} - {5}", cCharacter.Name, cCharacter.Level, cCharacter.Race, cCharacter.Spec, cCharacter.Class, cCharacter.Score)
        Next

        Console.WriteLine("Press any key to continue.")
        Console.ReadKey(True)
    End Sub

End Module
